home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / SCRIB3.PAK / SCRIBDOC.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  109 lines

  1. // ScribDoc.h : interface of the CScribbleDoc class
  2. //
  3. // This is a part of the Microsoft Foundation Classes C++ library.
  4. // Copyright (C) 1992-1995 Microsoft Corporation
  5. // All rights reserved.
  6. //
  7. // This source code is only intended as a supplement to the
  8. // Microsoft Foundation Classes Reference and related
  9. // electronic documentation provided with the library.
  10. // See these sources for detailed information regarding the
  11. // Microsoft Foundation Classes product.
  12. /////////////////////////////////////////////////////////////////////////////
  13.  
  14. // Forward declaration of data structure class
  15. class CStroke;
  16.  
  17. class CScribbleDoc : public CDocument
  18. {
  19. protected: // create from serialization only
  20.     CScribbleDoc();
  21.     DECLARE_DYNCREATE(CScribbleDoc)
  22.  
  23. // Attributes
  24. protected:
  25.     // The document keeps track of the current pen width on
  26.     // behalf of all views. We'd like the user interface of
  27.     // Scribble to be such that if the user chooses the Draw
  28.     // Thick Line command, it will apply to all views, not just
  29.     // the view that currently has the focus.
  30.  
  31.     UINT            m_nPenWidth;        // current user-selected pen width
  32.     BOOL            m_bThickPen;        // TRUE if current pen is thick
  33.     UINT            m_nThinWidth;
  34.     UINT            m_nThickWidth;
  35.     CPen            m_penCur;           // pen created according to
  36.                                         // user-selected pen style (width)
  37. public:
  38.     CTypedPtrList<CObList,CStroke*>     m_strokeList;   
  39.     CPen*           GetCurrentPen() { return &m_penCur; }
  40.  
  41. // Operations
  42. public:
  43.     CStroke* NewStroke();
  44.  
  45. // Overrides
  46.     // ClassWizard generated virtual function overrides
  47.     //{{AFX_VIRTUAL(CScribbleDoc)
  48.     public:
  49.     virtual BOOL OnNewDocument();
  50.     virtual void Serialize(CArchive& ar);
  51.     virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
  52.     virtual void DeleteContents();
  53.     //}}AFX_VIRTUAL
  54.  
  55. // Implementation
  56. protected:
  57.     void ReplacePen();
  58.  
  59. public:
  60.     virtual ~CScribbleDoc();
  61. #ifdef _DEBUG
  62.     virtual void AssertValid() const;
  63.     virtual void Dump(CDumpContext& dc) const;
  64. #endif
  65.  
  66. protected:
  67.     void            InitDocument();
  68.  
  69. // Generated message map functions
  70. protected:
  71.     //{{AFX_MSG(CScribbleDoc)
  72.     afx_msg void OnEditClearAll();
  73.     afx_msg void OnPenThickOrThin();
  74.     afx_msg void OnUpdateEditClearAll(CCmdUI* pCmdUI);
  75.     afx_msg void OnUpdatePenThickOrThin(CCmdUI* pCmdUI);
  76.     afx_msg void OnPenWidths();
  77.     //}}AFX_MSG
  78.     DECLARE_MESSAGE_MAP()
  79. };
  80.  
  81. /////////////////////////////////////////////////////////////////////////////
  82. // class CStroke
  83. //
  84. // A stroke is a series of connected points in the scribble drawing.
  85. // A scribble document may have multiple strokes.
  86.  
  87. class CStroke : public CObject
  88. {
  89. public:
  90.     CStroke(UINT nPenWidth);
  91.  
  92. protected:
  93.     CStroke();
  94.     DECLARE_SERIAL(CStroke)
  95.  
  96. // Attributes
  97. protected:
  98.     UINT                   m_nPenWidth;    // one pen width applies to entire stroke
  99. public:
  100.     CArray<CPoint,CPoint>  m_pointArray;   // series of connected points
  101.  
  102. // Operations
  103. public:
  104.     BOOL DrawStroke(CDC* pDC);
  105.  
  106. public:
  107.     virtual void Serialize(CArchive& ar);
  108. };
  109.